/*
 * ObjectsClass_MethodNameStatementStringifier.java
 * 
 *  Copyright (C) 2012-2013 Sylvain Lamprier, Tewfik Ziaidi, Lom Messan Hillah and Nicolas Baskiotis
 * 
 *  This file is part of CARE.
 * 
 *   CARE is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   CARE is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with CARE.  If not, see <http://www.gnu.org/licenses/>.
 */

package traces;

/**
 * 
 * Statement stringifier which only considers the name of the method and the classes of the caller and the callee.
 * Names of the corresponding objects are ignored. 
 * 
 * @author Sylvain Lamprier
 *
 */

public class ObjectsClass_MethodNameStatementStringifier extends StatementsStringifier {

	/**
	 * Stringifies a statement according to the classes of the caller and the calle of the corresponding method
	 * 
	 * The resulting string is in the form : Class(caller):Class(callee).method()
	 *   
	 * @param st
	 * @return a string representing the statement for an equivalence at a class level
	 */
	@Override
	public String getText(Statement st) {
		ObjectInstance caller=st.getSender();
		ObjectInstance callee=st.getReceiver();
		Method meth=st.getMethod();
		ObjectClass callerclass=caller.getObjectClass();
		ObjectClass calleeclass=callee.getObjectClass();
		String c="";
		if (st.isClosing()){c="closing_";} 
		String m=meth.getName()+"()";
		if (m.compareTo("()")==0){return("");}
		return callerclass.getName()+":"+calleeclass.getName()+"."+c+m;
	}

}
